<include file="Common/header-control" />
<div class="row">
    <div class="col-md-12">
        <ul class="nav nav-tabs">
            <li class="active"><a href="{:AU('publish/addons')}">发布指定模块</a></li>
        </ul>
    </div>
    <div class="box col-md-12">
        <div class="box-inner">
            <div class="box-header well" data-original-title="">
                <h2><i class="fa fa-list"></i> 确定发布</h2>
            </div>
            <script>
                require(['angular', 'bootstrap', 'underscore', 'util'], function(angular, $, _, util){
                    angular.module('app', []).controller('publisher', function($scope, $http){
                        $scope.entities = eval('{:json_encode($addons)}');
                        if($.isArray($scope.entities) && $scope.entities.length > 0) {
                            $scope.entity = $scope.entities[0];
                        }
                        $scope.trim = true;
                    });
                    angular.bootstrap(document, ['app']);
                });
            </script>
            <div class="box-content ng-cloak" ng-controller="publisher">
                <form id="theform" action="{:AU('publish/addons')}" method="post" class="form-horizontal" role="form">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">选择模块</label>
                        <div class="col-sm-4">
                            <select ng-model="entity" class="form-control" ng-options="entity.title for (name, entity) in entities" ng-change="change">
                            </select>
                        </div>
                    </div>
                    <div class="form-group description" ng-show="entity != null">
                        <div class="col-sm-offset-2 col-sm-10">
                            <div class="help-block">
                                标识: {{entity.name}} <br>
                                版本: {{entity.version}}
                            </div>
                            <div class="help-block">
                                描述: {{entity.description}}
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-4">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="trim" ng-model="trim" value="true"> 移除PHP文件中的注释
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" ng-show="trim">
                        <label class="col-sm-2 control-label">头部版权信息</label>
                        <div class="col-sm-10">
                            <textarea class="form-control" name="license" rows="6">
/**
* [{{entity.name}} Addon] Copyright (c) 2014
* [{{entity.name}} Addon] is an Addon for MicroBuilder System (MICROBUILDER.CN)
* [{{entity.name}} Addon] is NOT a free software, it under the license terms, visited {{entity.url}} for more details.
*/
                            </textarea>
                            <div class="help-block">这里的内容, 将会附加在在每一个PHP文件头部</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-1">
                            <input name="addon" type="hidden" value="{{entity.name}}" />
                            <button type="submit" class="btn btn-block btn-primary">开始发布</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<include file="Common/footer-control" />
